package test.redis;

import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class RunStart {

	public static void main(String[] args) {

		ExecutorService threads = Executors.newFixedThreadPool(500);
		
		for (int j = 0; j < 10000; j++) {
			threads.execute(new Runnable() {
				@Override
				public void run() {
					MemcachedClient client = MemcahedClientFactory
							.getInstance();
					for (int i = 0; i < 1000; i++) {

						String key = String.valueOf(new Date().getTime());
						client.set(key, "abc", false);
						client.get(key);

//						try
						{
							// 每0.5秒多启动一个线程 .
//							Thread.sleep(500);
							System.out.println("当前线程:"
									+ Thread.currentThread().getName() + ";"
									+ i);
						}
//						catch (InterruptedException e) {
//							e.printStackTrace();
//						}
					}
				}
			});

			// 每0.5秒多启动一个线程 .
//			try {
//				Thread.sleep(500);
//			} catch (InterruptedException e) {
//				e.printStackTrace();
//			}
			
		}

	}

}
